﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NHibernate;
using DotNet.Common.NHibernateUtil;
using ZLCMS.Data.Model;
using Newtonsoft.Json;
using ZLCMS.Business.Util;
using NHibernate.Criterion;

namespace ZLCMS.Web.SystemManage.weixin.Material
{
    public partial class LoadMaterial : System.Web.UI.Page
    {
        protected string _userAccount;

        protected void Page_Load(object sender, EventArgs e)
        {
            _userAccount = UserKit.GetUserAccountFailLogin();

            int id = Int32.Parse(Request["uid"]);

            using(ISession session = DotNet.Common.NHibernateUtil.SessionFactoryHelper.CreateSession())
            {
                Response.Write(JsonConvert.SerializeObject(session.CreateCriteria<WxMaterial>().Add(Expression.Eq("Id", id)).Add(Expression.Eq("OwnerAccount", _userAccount)).UniqueResult<WxMaterial>()));
            }
            Response.End();
        }
    }
}